UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ChywK9H5ztKMP7fD/KdB/Q8wChCtgFDOvi9I1qk25Wc=' 
WHERE 
  key_id = '836498fcf7e6b1698a8d983e18faaaf2b70820243c36f471faa2b66f66f4495c' 
  AND (
    token = 'ChywK9H5ztKMP7fD/KdB/Q8wChCtgFDOvi9I1qk25Wc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034