UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UvnDlNBGrDfOf86L2Od/z1bwDdf4ctf1qjKoHu7fjpA=' 
WHERE 
  key_id = '22504b30ecea60555d27164a63ec36605e13e9d75acb19dca190f90381f0118a' 
  AND (
    token = 'UvnDlNBGrDfOf86L2Od/z1bwDdf4ctf1qjKoHu7fjpA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034