UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZMnW1cVmAVi6x+aTWGvAeoNrRID0Rb2ixOoUj4vstg8='
WHERE
key_id = 'b58fcdd02e1913bc1f99d6b490d0cec7542240fe06f67663d32ddd92f098f57a'
AND (
token = 'ZMnW1cVmAVi6x+aTWGvAeoNrRID0Rb2ixOoUj4vstg8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)