UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oCs7z6KayYNONJx329mglBk4kT3vNEnLDlV41fOCTTo=' 
WHERE 
  key_id = '7ec5a586470423af7bbcfa1f535934fb6b4583e92108f15e6d640d58ed5ad435' 
  AND (
    token = 'oCs7z6KayYNONJx329mglBk4kT3vNEnLDlV41fOCTTo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031