UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DK81fwbi8ecIDAUoahBwRBI/qbLE9SnA3kxSa/Y+8MU=' 
WHERE 
  key_id = '7f6bed13a9e5e8e40bb132425f176b05123389241867c33662e04a8919d0acaa' 
  AND (
    token = 'DK81fwbi8ecIDAUoahBwRBI/qbLE9SnA3kxSa/Y+8MU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029