UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PF5lTwSwvmKQsdrl68zdhWF882EfVgFm+yC8H1REIUw=' 
WHERE 
  key_id = 'fe23b5e9f8642b226755b75646fb48a2710aa4ba8bdc56e203f537a545a01898' 
  AND (
    token = 'PF5lTwSwvmKQsdrl68zdhWF882EfVgFm+yC8H1REIUw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047