UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VJW5WaGWhvg+XuuPYZu0B1LfGqfyUzYBfYpv0lag7c0=' 
WHERE 
  key_id = '8f0e76d41bea35ede5eb7c011b93722cc877696a69930b5ac0e214c97ef1730a' 
  AND (
    token = 'VJW5WaGWhvg+XuuPYZu0B1LfGqfyUzYBfYpv0lag7c0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032