UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O+qEqS9XiGKYkibAV4dFOdiJg27NIG0J4NrV0WimVtk='
WHERE
key_id = '67a9acd627962e2863e60da420901bcd6a523e577f31ce02e3a28ec9d8273e05'
AND (
token = 'O+qEqS9XiGKYkibAV4dFOdiJg27NIG0J4NrV0WimVtk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)