UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7+1LSO5rXqplu5dSbd96OvY7TvOpzXoilFFS+vidSck=' 
WHERE 
  key_id = 'e9f2ab9327e5839a998598d19573b101672df737e3dcbfd44fe90d57b263621a' 
  AND (
    token = '7+1LSO5rXqplu5dSbd96OvY7TvOpzXoilFFS+vidSck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056