UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i+WGA8UoHx1DQn8240ue8OX9nHAwIpMxm5fhr6gjrYk='
WHERE
key_id = 'd902cfd959d51ac819ce1fbf82d5d963197e932e4d553f34a196b46417ef06c0'
AND (
token = 'i+WGA8UoHx1DQn8240ue8OX9nHAwIpMxm5fhr6gjrYk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)