UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bI0nMD6DISQPK4oFysLFdQ6q0Fe3zpuIeGaET7LayUo='
WHERE
key_id = 'ed850b0a6dcb8d9323ca5a90dd8610b74d5f319bbe0332700da99d25f8343a7f'
AND (
token = 'bI0nMD6DISQPK4oFysLFdQ6q0Fe3zpuIeGaET7LayUo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)