UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fCfsajSrQSBuxwtpymHUhEIuO8EfRS3wunCc5WwwseE=' 
WHERE 
  key_id = 'c31e7120bca00b23d5374c4cb438f5aa4908f0ecbe1964df1b79a582d61d0f25' 
  AND (
    token = 'fCfsajSrQSBuxwtpymHUhEIuO8EfRS3wunCc5WwwseE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034