UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gdnItbV4UH1jCItK1+tkGrY+AkgunX68joLy1ZD4xJQ=' 
WHERE 
  key_id = '3741e1768a062be1e9a1e8cb182483d269c8d549c6eaa25904e4c71f07869172' 
  AND (
    token = 'gdnItbV4UH1jCItK1+tkGrY+AkgunX68joLy1ZD4xJQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027