UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/fSQiDCnbDZw9bQPb4PkcgxjHVNvEbbX82OoHysaNMU='
WHERE
key_id = 'f45fdd57b27556eee93a73d58372c9237a4c334b196df4de23edb9248ce9ed17'
AND (
token = '/fSQiDCnbDZw9bQPb4PkcgxjHVNvEbbX82OoHysaNMU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)