UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A7Ya1RIGV3BnJdtUc81+FX855f1Nln5z3Lyqm8GD5wo='
WHERE
key_id = 'cf1a7396d3962167c5ec4a08def94ae687349191c45f43c42a6bb19427f2b844'
AND (
token = 'A7Ya1RIGV3BnJdtUc81+FX855f1Nln5z3Lyqm8GD5wo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)