UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rrF1UZIvklgf9twvWEvQvmIQ3isQ9Su3kKv9qxnGv34='
WHERE
key_id = 'e50d6dc3f539f75a21b3f18ea802c3921f57ed845c7363d8c0ff3bcddc76d5e4'
AND (
token = 'rrF1UZIvklgf9twvWEvQvmIQ3isQ9Su3kKv9qxnGv34='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)