UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x8mgMHz4Fp2Fu0OIfyd38+oyCsYwBWZ9V779MC79eQ0=' 
WHERE 
  key_id = '3b20d498a7fa109c5ffc6ac509617b105841bdeebe8d6c1721681d736b491df3' 
  AND (
    token = 'x8mgMHz4Fp2Fu0OIfyd38+oyCsYwBWZ9V779MC79eQ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029