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