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