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