UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mH1J06EU14zO8Zjvok1fu38fH8X7QJ+68ENIT+PRocE=' 
WHERE 
  key_id = '317e48eda229ce2aae2a853abbca6d3ed46800fb86c32d7d15bde0493f2dc3a8' 
  AND (
    token = 'mH1J06EU14zO8Zjvok1fu38fH8X7QJ+68ENIT+PRocE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028