UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M5CAzyTPChQmCDU1xWDvgLNHmUfITVqmqGrFgAob0EE=' 
WHERE 
  key_id = '1f8159f6121010da9eca61120796309c120b978df87a27a84d7deb5bc0ffa2c4' 
  AND (
    token = 'M5CAzyTPChQmCDU1xWDvgLNHmUfITVqmqGrFgAob0EE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065