UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CtPtsV43SW6Fd4ybR0lsjPehzrhsWkqY0EaqIaPaP3Y=' 
WHERE 
  key_id = '84fdab92491d6f85ca1a26670aead24a6049008cad9e004e2e74be1c9379ab77' 
  AND (
    token = 'CtPtsV43SW6Fd4ybR0lsjPehzrhsWkqY0EaqIaPaP3Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023