UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2daJOVXxwwEuHO1ektoUHzc64u80AIUEeBhDrRv8Z5k='
WHERE
key_id = 'e7f17428dc1864cdbe9542c07a5c5ab19adcf2afbc36ba387054f8cc0b19630d'
AND (
token = '2daJOVXxwwEuHO1ektoUHzc64u80AIUEeBhDrRv8Z5k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)