UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YAMCr4MMYzW7xTsqTD32KJviMuFsgjsY6T95omlE03w='
WHERE
key_id = '09e1c96e5c7b3690923c4d4e3db5d747278dd0199a1b78627b23a73faf0956ae'
AND (
token = 'YAMCr4MMYzW7xTsqTD32KJviMuFsgjsY6T95omlE03w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)