UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GJ4mc+8qtiFZ3Z3mCwAJORz1oh796R/KLN3LtKjPzEk=' 
WHERE 
  key_id = 'a9861a649d098eb24199abccb413b2e1446149c40ede9e4982ee052dbe13a861' 
  AND (
    token = 'GJ4mc+8qtiFZ3Z3mCwAJORz1oh796R/KLN3LtKjPzEk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050