UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vs9BeuXXq0yLUUKCkwyQVXi7ixW/7dhPy6yEnpvTLEE='
WHERE
key_id = 'd2def73cc289a1cb147d3f9766968a31abdba26c1f83c9017ff92ca3fa1ef603'
AND (
token = 'vs9BeuXXq0yLUUKCkwyQVXi7ixW/7dhPy6yEnpvTLEE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)