UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ao3RHsTRnWLyw1WKCWhFgTzzH1o3hULhaohIJ+YDiD4=' 
WHERE 
  key_id = 'd767113f068779233af4043d16a70ffae70be2d69334a7a5544186bdbd1c17c5' 
  AND (
    token = 'ao3RHsTRnWLyw1WKCWhFgTzzH1o3hULhaohIJ+YDiD4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031