UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/0WbicJjaFjyIjssTP2YEATznmd7J2VTPnB1KQKeWqA=' 
WHERE 
  key_id = 'f431a17de43c99c8143f9e33e9e24287b0b82c5d705c18d0ba040f7ae00038ce' 
  AND (
    token = '/0WbicJjaFjyIjssTP2YEATznmd7J2VTPnB1KQKeWqA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025