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