UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wiu4fP9vgUwjlg57u3BIzYhgqL+vIV4RN1dBLqrJ+ms=' 
WHERE 
  key_id = '1bbf47ee4c01db7dfd921c83f02356ec0d3785d6602a6a49d7ae5f8e758e6009' 
  AND (
    token = 'Wiu4fP9vgUwjlg57u3BIzYhgqL+vIV4RN1dBLqrJ+ms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032