UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O0nP6FSS52oxS5QMv3AXRPs+BWuidVOj4V2o+fgn5iA='
WHERE
key_id = '7fdbad1f85826dd220fa12c76abd2c154ecf774797f784ce939e1773f2f5816e'
AND (
token = 'O0nP6FSS52oxS5QMv3AXRPs+BWuidVOj4V2o+fgn5iA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)