UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z1Qz5kO+qCZXxerbp6zdqFG4vDrUobD10TK/AJri+dA='
WHERE
key_id = '1c08897985d9d5aa05a261a40450c23c9fe4e7c8db2a0e813586e4760da85b8a'
AND (
token = 'Z1Qz5kO+qCZXxerbp6zdqFG4vDrUobD10TK/AJri+dA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)