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