UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TRYGFVbgLvP83wvo3rabeWPJF8TGl0mUsvDky4GpwS4='
WHERE
key_id = '2c113f27a2f228127df04bf2b1a49a5eab7c7c820fcba47003ed1610ec66d67c'
AND (
token = 'TRYGFVbgLvP83wvo3rabeWPJF8TGl0mUsvDky4GpwS4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)